package com.jiugang.cardump.controller;


import com.jiugang.cardump.bean.InformationBean;
import com.jiugang.cardump.constant.StatusCodeConstant;
import com.jiugang.cardump.exception.SystemExceptionV110;
import com.jiugang.cardump.result.ResultInfoV110;
import com.jiugang.cardump.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2021-08-19
 */
@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * @param account
     * @param password
     * @return
     */
   @PutMapping("/login")
   public ResultInfoV110 login(String account,String password){
        log.info("UserController的login方法进入,参数account为"+account+",参数password为"+password);
        if(account == null || password == null){
            throw new SystemExceptionV110(InformationBean.setInformationBean(StatusCodeConstant.F002,"账号或密码"));
        }
        return userService.login(account, password);
   }

}

